package java_objects.objects_and_classes;

public class Dog {

	// related fields
	String name;
	boolean sleeping = false;

	// Initialize state
	Dog(String name) {
		this.name = name;
	}
	Dog(String name, boolean sleeping) {
		this.name = name;
		this.sleeping = sleeping;
	}

	// Defined ways of modifying the state
	
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	
	public void setSleeping(boolean sleeping) {
		this.sleeping = sleeping;
	}
	public boolean isSleeping() {
		return sleeping;
	}
	
	// Behavior
	void bark() {
		if (!sleeping) {
			System.out.println
			   (name + " is barking");
		}else {
			System.out.println
			  (name + " is sleeping");
		}
	}

}
